<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Redis;

class AdminAuth
{
    public function handle(Request $req, Closure $next):Response
    {
        if (empty($req->cookie('superbar_logintoken')) || $req->cookie('superbar_logintoken') != Redis::get('superbar_logintoken')) return redirect("/SPAdmin/login");
        return $next($req);
    }
}